import javax.microedition.media.Player;
import javax.microedition.media.PlayerListener;

final class SoundPlayer extends cls_af
        implements PlayerListener {

    private cls_ab e;

    SoundPlayer(cls_ab ab1) {
        e = ab1;
    }

    public final void playerUpdate(Player player, String s1, Object obj) {
        System.out.println("MIDP playerUpdate() " + s1);
        if (e.e == -1) {
            return;
        }
        SoundPlayer cplayer;
        try {
            cplayer = (SoundPlayer) e.c[e.e];
            if ("error".equals(s1)) {
                e.d = true;
                (player).removePlayerListener(cplayer);
                e.b.d(cplayer);
                e.c[e.e] = e.b.a(((cplayer)).d);
                cplayer.c = 0;
                e.e = -1;
                e.f = -1;
                e.b.b = false;
            } else {
                if ("endOfMedia".equals(s1) && !((cls_af) (player)).a || "stopped".equals(s1)) {
                    if (((cls_af) (player)).c != 1) {
                        cplayer.c = 0;
                    }
                    e.e = -1;
                    e.b.b = false;
                }
            }
        }
        catch (Exception ex) {
            System.out.println("Sound exception: " + ex.toString());
        }
    }
}